'use strict';const _hf=_Ky.extension.getBackgroundPage();_Hf=_hf._Hf;const _mf="chrome://extensions/?id="+_xg;
_Ce.add({reviews:_Ce.chromeWS+_xg+"/reviews",faq:_df+"faq",triggers:_df+"triggers",actions:_df+"actions",mruTabs:_df+"switch-to-last-used-tab-in-chrome",installer:_df+"files/"+_Q,natComp:_df+"native-component",tbBtns:_df+"custom-toolbar-buttons",domTabs:_df+"sort-group-close-tabs-by-domain",actMenu:_df+"action-menus",relseRam:_df+"release-ram-without-closing-tabs",chromeBugs:_df+"chromium-bugs",updHist:_df+"update-history",scrtDoc:_df+"scripting",omboxShrt:_df+"address-bar-shortcuts",mseHvrShrt:_df+
"hover-sensitive-shortcuts",donate:_df+"donations",winSecExcl:"https://support.microsoft.com/en-us/help/4028485/windows-10-add-an-exclusion-to-windows-security",fileAcc:_mf+"#:~:text=Allow%20access%20to%20file%20URLs",incogAcc:_mf+"#:~:text=Allow%20in%20Incognito"});function _2e(){let a=[];for(let [b,c]of _hf._h)a.push([b,c.name]);return a}
let _Fj=_wj(function*(a){let b=yield _X("/permns");return a.map(c=>`<c h=/permns/${c}/1>${b[c][0]}</c>`).join("")}),_9h=_wj(function*(a,b,c){let d=yield g=>_Ky.permissions.getAll(g),e={bkm:"bookmarks",ses:"sessions",bg:"background",notf:"notifications",dwld:"downloads",hst:"<all_urls>"},f={},h=[],l;"string"==typeof a&&(a=a.trim().split(/\s+/));for(let g of a){a="hst"==g?"origins":"permissions";let k=e[g];0>d[a].indexOf(k)&&("bg"!=g||c?(_ih(f,a,[]).push(k),h.push(g)):l=!0)}c=!0;if(!_Pt(f)){let g=`${yield _X(b)} <permReqLst>${yield _Fj(h)}</permReqLst>`;
yield k=>_yt(g,{},k);b=Date.now();(c=yield k=>_Ky.permissions.request(f,k))&&100>Date.now()-b&&(yield _xo("The permissions had already been granted. <hr b=2> All's well now.",1200).onShow,yield _Pi(500))}l&&_Ky.permissions.request({permissions:["background"]});return c});function _Xd(a={}){_gs(a,b=>{_Ky.permissions[b?"request":"remove"]({permissions:["background"]},_fy)})}
function _Pr(a){var b={};let c={};for(let [,,d]of _Rs(a.trigActList))if("openMenu"==d.action&&_Kg(d.params,"menuId")in _hf._2i.menuSpec)b[d.params.menuId]=_hf._2i.menuSpec[d.params.menuId];else if("saveUrl"==d.action||"saveElemUrl"==d.action)switch(d.params.method){case "notif":c.notf=!0;break;case "dwnlApi":c.dwld=!0}else if("runScript"==d.action&&!d.params.bkgrnd||"sendInput"==d.action&&_Kg(d.params,"intoPage")||_Vy(d.action,"copyElemUrl","openElemUrl","saveElemUrl"))c.hst=!0;b=JSON.stringify([a,
b]);/"type":"closedTabs"|"action":"(undoClose|reopen)"/.test(b)&&(c.ses=!0);/"type":"bmFolder"|"action":"(openBookmarks|bookmarkTabs)"/.test(b)&&(c.bkm=!0);_gs({trigActList:{},mouseGest:{}}.add(a),d=>{d&&(c.bg=!0)});return Object.keys(c)}function _iy(a,b,c,d,e){$("body > tabs")[0].insertBefore($(`<tab pnlId="${b}" ${d}>${c}</tab>`)[0],$(`body > tabs > tab[pnlId='${a}']`)[0]);_va[b]={func:e}}
let _Jp=()=>a=>{let b=[],c=new _do(()=>a(b.sort()));for(let [d,e]of _Sy.entries())_Ky.runtime.sendMessage(e,"ping",c.onReady(f=>!_fy()&&"pong"==f&&b.push(d)))};function _ni(a){let b="";for(let c in a)b+=`[iconUID=TBBtn${c}]::before {background-image: url(${_Kg(a[c],"icon","img")})} \n`;$("style[tbBtnIcons]").html(b)}function _5a(a){return a+1-(4<a?4:0)}
let _Au=new _0g,_Uj=_wj(function*(a){if(!$(a).is("[active]")){a=$(a).attr("pnlId");let b=$(`body > content > panel[pnlId='${a}']`)[0];if(!b){let [,c,d]=a.match(/^(.+?)(?::(\d+))?$/);b=$("<panel>").attr(c,"").attr("pnlId",a).css("pointer-events","none").appendTo("body > content")[0];let e=_va[c];e.templ&&$(b).append(_ne(e.templ));e.func&&(yield e.func(b,d));setTimeout(_Et(function*(){yield f=>_Bd(f);yield _Pi(250);yield _kr(!0);_Au.send("",!0);$(b).css("pointer-events","")}))}$("body > tabs tab, body > content > panel").attr("active",
null).filter(`[pnlId='${a}']`).attr("active","");location.hash=a;return b}}),_ty=_wj(function*(a,b){document.body.insertAdjacentHTML("beforeend",`<import src="${a}"></import>`);yield _kr(b)});function _ia(a){_2o()(b=>{_Zp("clear",b)(()=>{a(b)})})}function _8y(a){return"actions"+(a?":"+a:"")}
var _it=_wj(function*(a,b,c=[],d=!1,[e,f]){if(yield _9h(_Pr(a),"permMsgs/impSttgs",!0))yield h=>_Dd(a,h),yield h=>_hf._4h(h),_Pt(c)&&(e=f?`<b>${e}</b> out of ${e+f} actions were successfully imported. <hr b=4> <b>${f}</b> actions were not imported for being identical <br> to existing actions.`:"Settings imported successfully.",d||f?_yt(e,{type:"success"}):_xo(e,1200)),_1i()(),$("body > content > panel").remove(),$("body > tabs > tab").attr("active",null),yield _ug(_8y(b)),c.forEach(h=>$(`trigAct[actionId='${h}']`).addClass("selected")),
_vp($("trigActList")[0])});const _dw=_oo({trigActList:[],customEntities:{},toolbarBtns:{},sections:[]});
let _gp=_Et(function*(a,b=!0,c=!1,d=!1,e=!1,f=!0){let h=a.trigActList.length;const l=yield g=>_tl(_dw,g,chrome);_bk(l,a,b,f);b=a.trigActList.length;c=c?Object.keys(a.trigActList):[];f=_Kg(a.trigActList[Symbol.iterator]().next().value,1,"sctnId");a=_ze(l,a,d);yield _gu(yield _ep())._it(a,f,c,e,[b,h-b])}),_tg=_Et(function*(a,b,c=!1){try{var d=JSON.parse(a)}catch(e){_yt("The file specified is not a valid AutoControl settings file.",{type:"error"});return}b||(b=(yield _Qj())?"replace":yield _Sa(_ne("askAddReplSettgs"),
{width:"initial"}));"replace"==b?yield _qj(d):"add"==b&&(a=_tp({}.add(_dw,d)),_gp(a,!0,!1,!1,c))});var _ga=_Et(function*(a){let [b,c]=yield _Ya(_n(a,"text"));200!=c.status?_yt(`Error while opening the file. <hr b=2> "${a}" <hr b=2> ${_1k(c.status,c)}`,{type:"error"}):_tg(b,"add",!0)});
